/**
 * @author:linjiye
 * @date: 2024/01/13
 * @desc: 自定义钩子：进行异步获取本地化存储数据
 **/
import AsyncStorage from "@react-native-async-storage/async-storage";
import {useEffect, useState} from "react";

const useGetStorage = async (key:string) => {
    try {
        const value = await AsyncStorage.getItem(key);
        if (value !== null) {
            // console.log('获取的数据:', value);
            return JSON.parse(value);
        } else return null
    } catch (e) {
        console.error('获取数据时出错:', e);
        return null
    }
};

export default useGetStorage